package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 告警规则表
 * @TableName alert_rule
 */
@TableName(value ="alert_rule")
@Data
public class AlertRule implements Serializable {
    /**
     * 规则ID
     */
    @TableId(type = IdType.AUTO)
    private Long ruleId;

    /**
     * 规则名称
     */
    private String ruleName;

    /**
     * 设备ID
     */
    private Long deviceId;

    /**
     * 指标编码
     */
    private String indicatorCode;

    /**
     * 阈值最小值
     */
    private BigDecimal thresholdMin;

    /**
     * 阈值最大值
     */
    private BigDecimal thresholdMax;

    /**
     * 告警级别：1-一般，2-重要，3-紧急
     */
    private Integer alertLevel;

    /**
     * 通知渠道：1-短信，2-邮件，3-APP推送
     */
    private String notificationChannels;

    /**
     * 状态：1-启用，2-禁用
     */
    private Integer status;

    /**
     * 创建时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        AlertRule other = (AlertRule) that;
        return (this.getRuleId() == null ? other.getRuleId() == null : this.getRuleId().equals(other.getRuleId()))
            && (this.getRuleName() == null ? other.getRuleName() == null : this.getRuleName().equals(other.getRuleName()))
            && (this.getDeviceId() == null ? other.getDeviceId() == null : this.getDeviceId().equals(other.getDeviceId()))
            && (this.getIndicatorCode() == null ? other.getIndicatorCode() == null : this.getIndicatorCode().equals(other.getIndicatorCode()))
            && (this.getThresholdMin() == null ? other.getThresholdMin() == null : this.getThresholdMin().equals(other.getThresholdMin()))
            && (this.getThresholdMax() == null ? other.getThresholdMax() == null : this.getThresholdMax().equals(other.getThresholdMax()))
            && (this.getAlertLevel() == null ? other.getAlertLevel() == null : this.getAlertLevel().equals(other.getAlertLevel()))
            && (this.getNotificationChannels() == null ? other.getNotificationChannels() == null : this.getNotificationChannels().equals(other.getNotificationChannels()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRuleId() == null) ? 0 : getRuleId().hashCode());
        result = prime * result + ((getRuleName() == null) ? 0 : getRuleName().hashCode());
        result = prime * result + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode());
        result = prime * result + ((getIndicatorCode() == null) ? 0 : getIndicatorCode().hashCode());
        result = prime * result + ((getThresholdMin() == null) ? 0 : getThresholdMin().hashCode());
        result = prime * result + ((getThresholdMax() == null) ? 0 : getThresholdMax().hashCode());
        result = prime * result + ((getAlertLevel() == null) ? 0 : getAlertLevel().hashCode());
        result = prime * result + ((getNotificationChannels() == null) ? 0 : getNotificationChannels().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", ruleId=").append(ruleId);
        sb.append(", ruleName=").append(ruleName);
        sb.append(", deviceId=").append(deviceId);
        sb.append(", indicatorCode=").append(indicatorCode);
        sb.append(", thresholdMin=").append(thresholdMin);
        sb.append(", thresholdMax=").append(thresholdMax);
        sb.append(", alertLevel=").append(alertLevel);
        sb.append(", notificationChannels=").append(notificationChannels);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}